/*
 * @Author: LG
 * @Date: 2021-04-15 14:14:07
 * @Description:
 * @Last Modified By: liu.guo
 * @Last Modified Time: 2021-04-15 14:14:43
 */
export const directive = [
    {
        name: 'loadSelect',
        config: {
            bind(el, binding) {
                const selectWrap = el.querySelector(
                    '.el-select-dropdown .el-select-dropdown__wrap'
                );
                selectWrap.addEventListener('scroll', function (e) {
                    let sign = binding.arg;
                    const scrollDistance = this.scrollHeight - this.scrollTop - this.clientHeight;
                    // console.log(scrollDistance)
                    if (~~scrollDistance === 0) {
                        binding.value.loadData('scroll', binding.value.queryCode);
                    }
                });
            },
        },
    },
];
